//
//  QLMCustomWindow.m
//  Xiaomakuaixiu
//
//  Created by 龚碧容 on 2017/11/9.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "QLMCustomWindow.h"

@implementation QLMCustomWindow

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
+ (instancetype)sharedInstance{
    static QLMCustomWindow * sharedInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedInstance = [[self alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        sharedInstance.backgroundColor = [UIColor whiteColor];
    });
    return sharedInstance;
}

- (id)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        __weak __typeof(self)weakSelf = self;
        QLMLoginViewController *loginController = [QLMLoginViewController new];
        loginController.resultBlock=^(BOOL success){
            weakSelf.resultblock(success);
        };
        QLMCustomNavCtr *nav=[[QLMCustomNavCtr alloc] initWithRootViewController:loginController];
        self.rootViewController = nav;
    }
    return self;
}

+ (void)hideWindow{
    [QLMCustomWindow sharedInstance].hidden = YES;
}

@end
